def gen_list(length):
    i = 0
    while i<length:
        yield i
        i += 1


class iter_obj:
    def __init__(self, x):
        self.i = 0
        self.x = 5

    def __iter__(self):
        return self

    def __next__(self):
        if self.i < self.x:
            self.i  = self.i + 1
            return self.i
        else:
            raise StopIteration

